package com.changgou.oauth.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/oauth")
@CrossOrigin
public class LoginRedirect {

    @GetMapping("/login")
    public String login(@RequestParam(name = "FROM", required = false, defaultValue = "") String from, Model model) {
        //将跳转的路径传给页面
        model.addAttribute("from", from);
        return "login";
    }
}
